<template>
  <div>
    <sticky :offset="0">
      <x-header style="background-color:#000;"></x-header>
    </sticky>

    <group>
      <cell v-bind:title='worder.mR_StatusTitle'>
        <x-button mini plain>取消工单-{{worder.mrid}}</x-button>
        <a href="tel:18688888888">
          <x-button mini plain>催单</x-button>
        </a>
      </cell>
    </group>

    <group>
      <cell title='报修类别'>{{worder.firstClass}}-{{worder.secondClass}}</cell>
      <cell title='报修时间'>{{worder.mR_CreateDate | formatDate}}</cell>
      <cell title='报修地址' v-bind:inline-desc='building'></cell>

      <cell v-if="worder.mR_Pic" title='报修现场图片'><img :src='worder.mR_Pic' width="200" /></cell>
    </group>
    

  </div>
</template>

<script>
  import {
    getworkorder
  } from "@/api/workorder"
  import {
    util,
    cfgPageSize,
    formatDate
      } from "@/utils/"

  import {
    Cell,
    CellBox,
    Group,
    Badge,
    Sticky,
    XHeader,
    Toast,
    XButton,
  } from "vux"
  export default {
    data() {
      return {
        list: [],
        worder: [],
        building:"",
        listQuery: {
          woid: this.$route.params.num,
          PageIndex: 1,
          PageSize: 1,
        },
      }
    },
    filters: {
      formatDate(time) {
        var date = new Date(time)
        return formatDate(date, "yyyy-MM-dd hh:mm")
      }
    },
    created() {
      this.getorder()
    },
    methods: {
      getorder() {
        getworkorder(this.listQuery).then(response => {
          this.list = response.data.data.listView
          if (this.list) {
            this.worder = this.list[0]
            if(this.worder){
              let addressStr=this.worder.mR_Place.split("※")
              this.building = addressStr[0] + addressStr[1]
            }
          }

          console.log(this.list)
        })
      },
    },
    components: {
      Cell,
      CellBox,
      Group,
      Badge,
      Sticky,
      XHeader,
      Toast,
      XButton,
    }
  }

</script>

<style>
  .divgray {
    font-size: 14px;
    color: gray;
  }

</style>
